enum PageStatus { initial, loading, content, empty, error }

class PageState {
  final PageStatus status;
  final String? message;

  const PageState(this.status, {this.message});

  static PageState initial() => const PageState(PageStatus.initial);
  static PageState loading() => const PageState(PageStatus.loading);
  static PageState content() => const PageState(PageStatus.content);
  static PageState empty([String? msg]) => PageState(PageStatus.empty, message: msg);
  static PageState error([String? msg]) => PageState(PageStatus.error, message: msg);

  bool get isLoading => status == PageStatus.loading;
  bool get isContent => status == PageStatus.content;
  bool get isEmpty => status == PageStatus.empty;
  bool get isError => status == PageStatus.error;
}